package com.job.ali;

/**
 * @author angzhijin
 * @Description
 * @create 2022-09-22 8:57 AM
 */
import java.util.*;
public class Ant0922 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        if(n<3){
            System.out.println(-1);
            return;
        }
        int a =1, b=2; // a奇数 b偶数
        int[][] nums = new int[n][n];
        int i=0, j=0;
        for (int k = 0; k < n * n; k++) {
            if((k/2)%2==0){
                nums[i][j] = a;
                a+=2;
            }else{
                nums[i][j] = b;
                b+=2;
            }
            j++;
            if(j>=n){
                i++;
                j=0;
            }
        }

        if(Math.max(a,b) != n*n){
            System.out.println(-1);
            return;
        }
        for(int[] num : nums){
            for (int t : num) {
                System.out.print(t);
            }
            System.out.println();
        }
    }

    public static void B(String[] args) {
        Scanner sc = new Scanner(System.in);
        char[] line = sc.nextLine().toCharArray();
        int k = Integer.parseInt(sc.nextLine());
        int len = line.length;
        int[] dp = new int[len];
        int count =0;
        for (int i = 0; i < len; i++) {
            int tmp = 0;
            for (int j = i; j < len; j++) {
                tmp = tmp * 10 + line[j] -'0';
                if(tmp<k)
                    count++;
                else
                    break;
            }
        }
        System.out.println(count);
    }

    public static void A(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int q = sc.nextInt();
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = sc.nextInt();
        }
        for (int i = 0; i < q; i++) {
            int op = sc.nextInt();
            int I = sc.nextInt();
            int x = sc.nextInt();
            if(op==1){
                nums[I-1] = x;
            }else{
                int count =0;
                for (int j = 0; j < I; j++) {
                    if (nums[j]==x)
                        count++;
                }
                System.out.println(count);
            }
        }
    }

}
